package cn.maszy.action.projectmanagement;

import org.springframework.beans.factory.annotation.Autowired;

import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.projectmanagement.B_T_Ufp_Status;
import cn.maszy.service.projectmanagement.B_T_Ufp_StatusService;

public class StatusActuion extends BaseAction<B_T_Ufp_Status>{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Autowired
	private  B_T_Ufp_StatusService b_T_Ufp_StatusService;
	private B_T_Ufp_Status b_T_Ufp_Status;
	private String checkIds;
	/*********************class set/get****************************/
	public B_T_Ufp_Status getB_T_Ufp_Status() {
		return b_T_Ufp_Status;
	}
	public void setB_T_Ufp_Status(
			B_T_Ufp_Status b_T_Ufp_Status) {
		this.b_T_Ufp_Status = b_T_Ufp_Status;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 插入
	 */
	public String statusUpdate()
	
	{
		int i=b_T_Ufp_StatusService.update(b_T_Ufp_Status);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "StatusList","", "forward", "projectmanagement/StatusList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询
	 * @return
	 */

	public  String statusList() 
	{
		pager = new Pager<B_T_Ufp_Status>(pageNum, numPerPage,orderField,orderDirection);
		pager= b_T_Ufp_StatusService.selectList(b_T_Ufp_Status,pager);
		return SUCCESS;
	}
	/**
	 * 删除
	 * @return
	 */
	public String statusDel()
	{
		int i=b_T_Ufp_StatusService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "StatusList","", "forward", "projectmanagement/StatusList");
		return ajaxForwardError(getText("msg.operation.failure"));
	
	}
	//跳转到新建页面
	public String statusAdd()
	
	{
		if(b_T_Ufp_Status==null){
			b_T_Ufp_Status=b_T_Ufp_StatusService.selectOne("");
		}else{
			b_T_Ufp_Status=b_T_Ufp_StatusService.selectOne(b_T_Ufp_Status.getStatusId());
		}
		return SUCCESS;
		
	}

}
